<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>设置中心</title>
		<link rel="stylesheet" href="../css/common.css">
		<link rel="stylesheet" href="../css/page.css">
		<script src="../js/jquery-3.2.1.min.js"></script>
		<script src="../js/media.js"></script>
		<script src="../js/common.js"></script>
		<style>
		</style>
	</head>
	<body>
		<!--正文-->
		<div class="setting-center bc-gray">
			<!--<ul>
                <li class="flex">
                    <span>退货地址</span>
                    <em></em>
                </li>
            </ul>-->
			<p class="p p1">资质信息</p>
			<ul>
				<li class="flex" onclick="ispast('../page/option_chose.html')">
					<span>实名认证</span>
					<em id="true_name">未认证</em>
				</li>
				<li class="flex" onclick="ispast2('../page/My-blessing.html')">
					<span>消保金</span>
					<em id='amount'>未缴纳</em>
				</li>
			</ul>
			<p class="p p1">店铺设置</p>
			<ul>
				<!--<li class="flex">
                   <span>竞拍设置</span>
                   <em></em>
               </li>-->

				<!--<li class="flex">
                        <span>优惠券设置</span>
                        <em>未开启</em>
                    </li>-->
				<!--<li class="flex" onclick="ispast2('../page/Shop-settings.html?time='+Math.random())">
					<span>店铺折扣设置</span>
					<em id="discount">未开启</em>
				</li>-->
				<li class="flex" onclick="ispast2('../page/Bidding-settings.html')">
					<span>买家出价条件设置</span>
					<em id="msg">未开启</em>
				</li>
				<li class="flex" onclick="ispast2('dianpuweizhilist.html')">
					<span>店铺位置</span>
					<em id="m"><span style="padding: 0 5px;"></span></em>
				</li>
				<li class="flex" onclick="ispast2('storeinf.html')">
					<span>店铺信息</span>
					<em id="m"><span style="padding: 0 5px;"></span></em>
				</li>
			</ul>
			<p class="p p1">用户设置</p>
			<ul>
				<li class="flex" onclick="ispast2('../page/my-fan.html')">
					<span>粉丝</span>
					<em id="fan">0</em>
				</li>
				<!--<li class="flex" onclick="javascript:window.location.href='../page/Block-users.html'">-->
				<!--<span>屏蔽用户</span>-->
				<!--<em id="user">0</em>-->
				<!--</li>-->
			</ul>
			<p class="p p1">
				高级设置
			</p>
			<ul>
				<li class="flex">
					<span>固定『我的』为卖家中心</span>
					<!--      <div class="checkbox checkbox-slider&#45;&#45;b-flat">
                  <label>
                      <input type="checkbox"><span></span>
                  </label>
                  </div>-->
					<div class="flexss" style="flex: 1;">

					</div>
					<div class="flexss" style="flex: 1;">

					</div>
					<div class="flexss" style="flex: 1;">

					</div>
					<div class="flexss" style="flex: 1;text-align: right;">
						<img id="addimg" mytype="0" src="../img/选择%201@2x.png" alt="" style="width: 40px;height: 20px;">
					</div>
				</li>

			</ul>
		</div>
	</body>
	<script>
		var isallow = false; //审核参数
		var isupmoney = false;//消保金
		var person_store = true;//个人店铺
		$.ajax({ //获取店铺的认证信息
			url: base_url + 'ZITAOHUI/store/msg',
			data: {
				store_id: sessionStorage.getItem("s_id")
			},
			success: function(data) {
				console.log(data)
				$("#fan").text(data.extend.list.store_total_fans);
				$("#user").text(data.extend.shieldNum);
				let all_data = data.extend.list;
				if(all_data.store_authority == 0) {
					$('#true_name').text('未审核');
					isallow = 0;
				} else if(all_data.store_authority == 1) {
					$('#true_name').text('已审核');
					//console.log("名字的长度："+all_data.enterprise_name.length);
					if(all_data.enterprise_name){//通过判断字符串的长度判断是个人店铺还是企业店铺！
						$('#true_name').text('企业店铺已审核');
						person_store = false;
					}else{
						$('#true_name').text('个人店铺已审核');
						person_store = true ;
					}
					isallow = 1;
				} else if(all_data.store_authority == 21) {
					$('#true_name').text('个人认证审核中');
					isallow = 21;
				} else if(all_data.store_authority == 22) {
					$('#true_name').text('企业认证审核中');
					isallow = 22;
				} else if(all_data.store_authority == 3) {
					$('#true_name').text('审核失败');
					isallow = 3;
					window.sessionStorage.setItem('authority_discrbe', all_data.authority_discrbe)
	
				}
				if(all_data.store_amount_guaranteed == 0) {
					$('#amount').text('未缴纳');
					isupmoney = false;
				} else {
					$('#amount').text(all_data.store_amount_guaranteed);
					isupmoney = true;
				}
				if(all_data.is_discount_rate == true) {
					$('#discount').text('已开启')
				} else {
					$('#discount').text('未开启')
				}
				if(all_data.default_rate == true || all_data.is_first_Msg != 0 || all_data.is_first == true) {
					$('#msg').text('已设置')
				} else {
					$('#msg').text('未设置')
				}
			}
		})
	
		function ispast(urls) {
			if(isallow == 0) {
				window.location.href = urls;
			} else if(isallow == 1) {
				alert('您的店铺已经通过审核');
			} else if(isallow == 3) {
				window.location.href = urls;
			} else {
				window.location.href = urls;
			}
		}
		function ispast2(urls) {
			if(isallow == 21 || isallow == 22) {
				alert('店铺正在认证中,请稍后');
			} else if(isallow == 0) {
				alert('请先进行个人或店铺认证');
				window.location.href = "../page/option_chose.html"; //跳转到个人/店铺认证页面
			} else if(isallow == 1) {
				window.location.href = urls+"?person_store=1"+"&is_person_store="+person_store;
			} else if(isallow == 3) {
				alert('认证失败，请重新认证');
				window.location.href = "../page/option_chose.html"; //跳转到个人/店铺认证页面
			}
		}
		$(function() {
			$("#addimg").click(function() {
				var $type = $("#addimg").attr("mytype");
				if($type == 0) {
					$("#addimg").attr("src", "../img/选择%202@2x.png")
					$(this).attr("mytype", "1")
					localStorage.setItem("mytype", "1");
				} else {
					$("#addimg").attr("src", "../img/选择%201@2x.png")
					$(this).attr("mytype", "0");
					localStorage.setItem("mytype", "0");
				}
			});
			if(localStorage.getItem("mytype") == 1) {
				$("#addimg").attr("src", "../img/选择%202@2x.png");
				$("#addimg").attr("mytype", "1")
			} else {
				$("#addimg").attr("src", "../img/选择%201@2x.png");
				$("#addimg").attr("mytype", "0")
			}
		})
	</script>
</html>